Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Qwen2-VL static generation #1512

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open

Conversation

Spycsh
Copy link
Contributor

@Spycsh Spycsh commented Nov 22, 2024

What does this PR do?

Add Qwen2-VL static generation.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

@Spycsh
Copy link
Contributor Author

Spycsh commented Nov 22, 2024

The pipeline test will not pass until optimum-habana matches the latest changes in transformers huggingface/transformers#34769, namely the task name image-to-text ==> image-text-to-text in examples/image-to-text/run_pipeline.py for many of the VLMs. I have currently validated the pass using my own test script https://github.com/Spycsh/qwen-vl-hpu/blob/main/qwen2_vl.py.

@jiminha
Copy link
Collaborator

jiminha commented Nov 25, 2024

age-to-text ==> image-text-to-text in examples/image-to-text/run_pipeline.py for many of the VLMs. I have currently validated the pass using my own test script https://github.com/Spycsh/qwen-vl-hpu/blob/main/qwen2_vl.py.

Are you saying we need transformer4.47 for this to work or can you update the examples/images-to-text/run_pipeline to support both cases?

@jiminha
Copy link
Collaborator

jiminha commented Nov 25, 2024

@tthakkal Could you also review this please. THanks.

@Spycsh
Copy link
Contributor Author

Spycsh commented Nov 27, 2024

age-to-text ==> image-text-to-text in examples/image-to-text/run_pipeline.py for many of the VLMs. I have currently validated the pass using my own test script https://github.com/Spycsh/qwen-vl-hpu/blob/main/qwen2_vl.py.

Are you saying we need transformer4.47 for this to work or can you update the examples/images-to-text/run_pipeline to support both cases?

Yes. An update to latest transformers is needed here. run_pipeline.py also need to be updated correspondingly. I will look into this and get back to you later.

@Spycsh
Copy link
Contributor Author

Spycsh commented Dec 9, 2024

Hello, with some small fixes, now the example can be run with following command under transformers 4.45.2 (current optimum-habana compatible version)

python3 run_pipeline.py     --model_name_or_path Qwen/Qwen2-VL-2B-Instruct     --bf16

Kindly review this at your convenience. Thank you! :)

Copy link
Contributor

@vidyasiv vidyasiv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Spycsh
Copy link
Contributor Author

Spycsh commented Dec 11, 2024

Hi @vidyasiv @jiminha , I have added the tests and README, tested the Qwen2-VL-7b and Qwen2-VL-2b with GAUDI2_CI=1 RUN_SLOW=1 python -m pytest test_image_to_text_example.py -v -s -k Qwen/Qwen2-VL-2B-Instruct , and also fixed the issue when using HPU graph and made HPU graph enabled as default. Now the perf with warmups should be good enough.

Please review at your convenience. Thank you! :)

Copy link
Contributor

@vidyasiv vidyasiv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @Spycsh for adding tests

Copy link
Contributor

@vidyasiv vidyasiv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm (only reviewed from test perspective), approving to remove request changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants